import bus from '@/bus'
import { renderButton } from '@/util';
let data = {
	status: 'pass',
	totalItem: 1,
	pageSize: window.$pageSize,
	currentPage: 1,
	is_admin: '',
	columns: [{
		type: 'selection',
		align: 'left',
		width: 60
	}, {
		title: '角色名称',
		key: 'name',
		minWidth: 150
	}, {
		title: '创建时间',
		align: 'left',
		key: 'createDate',
    minWidth: 200
	}, {
		title: '预设角色',
		align: 'left',
		key: 'isSystem',
    minWidth: 150,
		render: (h, params) => {
     const list = [{
			name: '无',
			id: '0'
		 }, {
				name: '设计师',
        id: '1'
			}, {
        name: '制版师',
        id: '2'
      }, {
        name: '制样师',
        id: '3'
      }, {
        name: '管理员',
        id: '4'
      }]
			const text = list.find(item =>  item.id == params.row.yu_type)
			return h('div', text.name)
		}
	}, {
		title: '描述',
		align: 'left',
		key: 'description',
    minWidth: 200
	}, {
		title: '操作',
		align: 'right',
		minWidth: 200,
		fixed: 'right',
		render: (h, params) => {
			return (
				<div>
					{ renderButton(h, { text: '编辑', type: 'primary',  disabled: params.row.isMaster,},
						()=>{ bus.$emit("onEdit", params.row)})}
					{ renderButton(h, { text: '删除',type: 'warning', disabled: params.row.isSystem   || params.row.isLocked ? true : false,},
						()=>{ bus.$emit("onDelete", params.row.id, params.row.isSystem, params.row.name)})}
					{ renderButton(h, { text: '预设',type: 'default', disabled: (params.row.is_admin !==1 && params.row.yu_type > 0)  ? true : false,},
						()=>{ bus.$emit("onPre", params.row.id, params.row.yu_type, params.row.name)})}
				</div>
			)
		}
	}],
	data: []
}
export default data